<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增【请填写功能名称】')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-template-add">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">任务描述：</label>
                <div class="col-sm-8">
                    <input name="jobDesc" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">任务执行CRON：</label>
                <div class="col-sm-8">
                    <input name="jobCron" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">执行器：</label>
                <div class="col-sm-8">
                    <select name="jobGroup" class="form-control" th:with="type=${@jobGroupService.findAll()}">
                        <option th:each="item : ${type}" th:text="${item.title}" th:value="${item.id}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">执行器路由策略：</label>
                <div class="col-sm-8">
                    <select name="executorRouteStrategy" class="form-control">
                        <option value="RANDOM">随机</option>
                        <option value="LEAST_FREQUENTLY_USED">最不经常使用</option>
                        <option value="ROUND">轮询</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">调度状态：</label>
                <div class="col-sm-8">
                    <select name="triggerStatus" class="form-control">
                        <option value="0">停止</option>
                        <option value="1">运行中</option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "base/job/template";
        $("#form-template-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-template-add').serialize());
            }
        }

        $("input[name='addTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='glueUpdatetime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>